/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.colswe.solestac.control;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author solid
 */
public class LogControl {

    /**Object to manage the logs.
     */
    private Logger log;
    /**Object to handle the logs in a file.
     */
    private FileHandler handler;

    /**Creates the handler to manage the log events.
     * @param name The name of the class invoking the logger.
     * @throws IOException If exist a problem with the file.
     */
    public LogControl(final String name) throws IOException {
        this.log = Logger.getLogger(name);
        this.handler = new FileHandler("lib/log/log_error.xml", true);
        log.addHandler(handler);
        log.setLevel(Level.WARNING);
    }

    /**Records the exception in the log.
     * @param ex The exception to save.
     */
    public void logging(final Exception ex) {
        log.warning(ex.toString());
    }
}
